package com.quad.innovators.salesease.enums;

import java.util.HashMap;
import java.util.Map;

import lombok.Getter;

/**
 * @author : shanshan.li
 * @createTime : 2024/10/23 23:26
 * @Version : 1.0 
 */
@Getter
public enum PaymentStatusEnum {
    ERROR(-1, "错误状态"),
    NOT(0, "未付款"),
    PAY(1, "已付款");

    private final int code;
    private final String description;

    PaymentStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    static final Map<Integer, PaymentStatusEnum> map = new HashMap<>();

    static {
        PaymentStatusEnum[] values = values();
        for (PaymentStatusEnum value : values) {
            map.put(value.code, value);
        }
    }

    public static PaymentStatusEnum useCodeGetEnum(Integer code) {
        return map.getOrDefault(code, ERROR);
    }

}
